package ru.linnenson.darshana;

import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;
import org.junit.jupiter.api.Test;
import java.io.File;

public class TesseractTest {

  @Test
  public void test() throws TesseractException {

    final File image = new File("src/test/resources/11.png");
    final Tesseract tesseract = new Tesseract();

    tesseract.setDatapath("src/test/resources/tessdata");
    tesseract.setLanguage("rus");
    tesseract.setPageSegMode(1);
    tesseract.setOcrEngineMode(1);

    final String result = tesseract.doOCR(image).replaceAll("\n", " ");

    System.out.println("result: " + result);
  }
}
